//
//  TableViewCell.swift
//  GreenDeal
//
//  Created by Moennig Q on 15/12/2022.
//

import UIKit
import RxSwift
import RxCocoa

class TableViewCell: UITableViewCell {
    lazy var disposeBag = DisposeBag()

    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
    }
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.selectionStyle = .none
        self.backgroundColor = UIColor(hexStr: Constant.TransparentColorHexStr)
        self.contentView.backgroundColor = UIColor(hexStr: Constant.TransparentColorHexStr)
        setUpviews()
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        
    }
    override func layoutSubviews() {
        super.layoutSubviews()
    }
    //点击没有取消背景色
    override func setSelected(_ selected: Bool, animated: Bool) {
        self.contentView.backgroundColor = UIColor(hexStr: Constant.TransparentColorHexStr)
    }
    override func setHighlighted(_ highlighted: Bool, animated: Bool) {
        self.contentView.backgroundColor = UIColor(hexStr: Constant.TransparentColorHexStr)
    }
    //每次重用cell的时候都会释放之前的disposeBag，为cell创建一个新的dispose。保证cell被重用的时候不会被多次订阅，造成错误
    override func prepareForReuse() {
        super.prepareForReuse()
        disposeBag = DisposeBag()
        
    }
    func setUpviews(){
        
    }

}
